package com.android.lib.download

import android.text.TextUtils

object DownloadManager {

    /**
     * 最大下载任务数
     */
    const val MAX_TASK = 2

    /**
     * 生成DownloadTask任务
     */
    fun getDownloadTask(
        url: String
    ): DownloadTask? {
        if (TextUtils.isEmpty(url)) return null
        var downloadTask = DownloadPool.getPrepareTask(url)
        if (downloadTask == null) {
            downloadTask = DownloadTask(url = url)
            DownloadPool.addPrepareTask(url, downloadTask)
        }
        return downloadTask
    }
}